package com.yiwei;

import java.util.Date;
import java.util.logging.FileHandler;
import java.util.logging.LogManager;
import java.util.logging.SimpleFormatter;

import com.yiwei.controller.*;
import com.yiwei.controller.third.RuiKangServiceBySqlServer;

public class Main {

    public static void main(String[] args) throws Exception {
//        //设置logger保存日志路径
        String filePath = AssistantConfig.properties.getProperty("logPath") + "/" + new Date().getTime() + ".log";
        FileHandler fh = new FileHandler(filePath);
        fh.setFormatter(new SimpleFormatter());
        LogManager.getLogManager().getLogger("").addHandler(fh);

        // 启动文件监控服务
        YWFileMonitor ywFileMonitor = new YWFileMonitor();

        AssistantHttpController assistantHttpController = new AssistantHttpController();
        // 将文件服务中的暂存队列设置到接口服务中
        assistantHttpController.setImgIdQueue(ywFileMonitor.getImgIdQueue());

//        YWSchedule schedule = new YWSchedule();
//        schedule.allRecordSynchronize();
//        schedule.oneDaySynchronize();

        // 启动接口服务
        assistantHttpController.serviceStart();
        //初始化SQL Server数据库连接
        RuiKangServiceBySqlServer sqlServer = new RuiKangServiceBySqlServer();
    }
}
